home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / plnk081.zip / pilot-link.0.8.1 / Java / Pdapilot / CategoryAppBlock.java < prev    next >
Text File  |  1997-08-05  |  1KB  |  55 lines

  1.  
  2. package Pdapilot;
  3.  
  4. import java.io.*;
  5.  
  6. public class CategoryAppBlock extends AppBlock {
  7.     public boolean[] categoryRenamed;
  8.     public int categoryLastUniqueID;
  9.     public String[] categoryName;
  10.     public int[] categoryID;
  11.         
  12.     public CategoryAppBlock() {
  13.         super();
  14.     }
  15.  
  16.     public native void unpack(byte[] data);
  17.     public native byte[] pack();
  18.     
  19.     public void fill() {
  20.         categoryRenamed = new boolean[16];
  21.         categoryLastUniqueID = 0;
  22.         categoryName = new String[16];
  23.         categoryID = new int[16];
  24.     }
  25.         
  26.     public CategoryAppBlock(byte[] contents) {
  27.         super(contents);
  28.     }
  29.         
  30.     public String describe() {
  31.         StringBuffer c;
  32.         if ((categoryName == null) || (categoryID == null) || (categoryRenamed == null)) {
  33.             c = new StringBuffer("no categories");
  34.         } else {
  35.             c = new StringBuffer("name             id\trenamed\n");
  36.             for (int i=0;i<categoryName.length;i++) {
  37.                 if (categoryName[i].length() > 0) {
  38.                     c.append(categoryName[i]);
  39.                     for(int j=16;j>categoryName[i].length();j--)
  40.                         c.append(" ");
  41.                     c.append(" ");
  42.                     c.append(categoryID[i]);
  43.                     c.append("\t");
  44.                     c.append(categoryRenamed[i]);
  45.                     c.append("\n");
  46.                 }
  47.             }
  48.         }
  49.         return "categoryLastUniqueID="+categoryLastUniqueID+
  50.                 "\n" + c;
  51.     }
  52. }
  53.  
  54.         
  55.